package org.spolo.android.exception;

import android.content.Context;
import android.widget.Toast;

public class ExceptionHandler extends Exception {
	private static final long serialVersionUID = -8321625424242754396L;
	private String errorMessage;

	public ExceptionHandler(String detailMessage) {
		super(detailMessage);
	}

	public ExceptionHandler(String detailMessage, Exception e) {
		this.errorMessage = detailMessage;
	}

	public void handler(Context con) {
		if (this.errorMessage == null && this.errorMessage.equals("")) {
			Toast.makeText(con, this.getCause().toString(), Toast.LENGTH_LONG)
					.show();
		} else {
			Toast.makeText(con, this.errorMessage, Toast.LENGTH_LONG).show();
		}
	}
}
